/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.isn.hospitalizacion.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author pool
 */
@Entity
@Table(name = "tipo_diagnostico")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TipoDiagnostico.findAll", query = "SELECT t FROM TipoDiagnostico t"),
    @NamedQuery(name = "TipoDiagnostico.findByCodTipoDiag", query = "SELECT t FROM TipoDiagnostico t WHERE t.codTipoDiag = :codTipoDiag"),
    @NamedQuery(name = "TipoDiagnostico.findByDescTipoDiag", query = "SELECT t FROM TipoDiagnostico t WHERE t.descTipoDiag = :descTipoDiag")})
public class TipoDiagnostico implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Cod_Tipo_Diag", columnDefinition="CHAR(5) unsigned")
    private String codTipoDiag;
    @Column(name = "Desc_Tipo_Diag")
    private String descTipoDiag;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codTipoDiag")
    private Collection<OrdenHospitalizacion> ordenHospitalizacionCollection;

    public TipoDiagnostico() {
    }

    public TipoDiagnostico(String codTipoDiag) {
        this.codTipoDiag = codTipoDiag;
    }

    public String getCodTipoDiag() {
        return codTipoDiag;
    }

    public void setCodTipoDiag(String codTipoDiag) {
        this.codTipoDiag = codTipoDiag;
    }

    public String getDescTipoDiag() {
        return descTipoDiag;
    }

    public void setDescTipoDiag(String descTipoDiag) {
        this.descTipoDiag = descTipoDiag;
    }

    @XmlTransient
    public Collection<OrdenHospitalizacion> getOrdenHospitalizacionCollection() {
        return ordenHospitalizacionCollection;
    }

    public void setOrdenHospitalizacionCollection(Collection<OrdenHospitalizacion> ordenHospitalizacionCollection) {
        this.ordenHospitalizacionCollection = ordenHospitalizacionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codTipoDiag != null ? codTipoDiag.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoDiagnostico)) {
            return false;
        }
        TipoDiagnostico other = (TipoDiagnostico) object;
        if ((this.codTipoDiag == null && other.codTipoDiag != null) || (this.codTipoDiag != null && !this.codTipoDiag.equals(other.codTipoDiag))) {
            return false;
        }
        return true;
    }

}
